import numpy as np 
from matplotlib import pyplot as plt 

f=50.1

d = np.loadtxt('wave.txt'); #最普通的loadtxt

x = np.arange(0,800) 
s=np.sin(2*np.pi*(x)*f/800);
c=np.cos(2*np.pi*(x)*f/800);

ss=np.sum(s*d)/800;
cs=np.sum(c*d)/800;

print(f)

print(np.sqrt(ss*ss+cs*cs))
#plt.plot(d*s);
#plt.plot(r) 

#plt.show()


